import request from "@/utils/request";
import { parseStrEmpty } from "@/utils/ruoyi";

// 查询省市区数据
export function addressJson() {
  return request({
    url: "/system/province/list",
    method: "get",
  });
}

// 查询病人最近照片
export function listPictureLast(query) {
  return request({
    url: "/system/photo/latest/list",
    method: "get",
    params: query,
  });
}

//新增病人
export function addPatient(data) {
  return request({
    url: "/system/patient",
    method: "post",
    data: data,
  });
}
//批量新增病人方案
export function batchAddPatientPlan(data) {
  return request({
    url: "/system/patientPlan/batchAdd",
    method: "post",
    data: data,
  });
}
//批量修改病人方案
export function batchUpdatePatientPlan(data) {
  return request({
    url: "/system/patientPlan/batchUpdate",
    method: "put",
    data: data,
  });
}

//新增就诊
export function addVisit(data) {
  return request({
    url: "/system/visit",
    method: "post",
    data: data,
  });
}

//搜索
export function findPatient(query) {
  return request({
    url: "/system/visit/patientList/" + query.patientPhone,
    method: "get",
    params: { diseaseId: query.diseaseId },
  });
}

// 提交照片
export function updatePhoto(data) {
  return request({
    url: "/system/photo",
    method: "put",
    data: data,
  });
}
//查询病人方案
export function listPlan(query) {
  return request({
    url: "/system//system/plan/list",
    method: "get",
    params: query,
  });
}

//根据就诊id查询病人方案
export function listPlanByVisitId(query) {
  return request({
    url: "/system/patientPlan/listByVisitIdAndPlanCategoryId",
    method: "get",
    params: query,
  });
}

//删除就诊
export function delVisit(visitIds) {
  return request({
    url: "/system/visit/" + visitIds,
    method: "delete",
  });
}

//删除照片
export function delPic(photoIds) {
  return request({
    url: "/system/photo/" + photoIds,
    method: "delete",
  });
}
// 新增照片
export function addPhoto(data) {
  return request({
    url: "/system/photo",
    method: "post",
    data: data,
  });
}
// 查询顾客每组照片列表
export function listPhoto(data) {
  return request({
    url: "/system/photo/indexList",
    method: "post",
    data: data,
  });
}
//根据专病名称查询方案列表并分类
export function listPlanByCategoryId(query) {
  return request({
    url: "/system/plan/listByPlanCategoryId",
    method: "get",
    params: query,
  });
}
//新增处方治疗记录
export function addTreatmentRecord(data) {
  return request({
    url: "/system/log",
    method: "post",
    data: data,
  });
}
//修改处方治疗记录
export function updateTreatmentRecord(data) {
  return request({
    url: "/system/log",
    method: "put",
    data: data,
  });
}
//查询处方记录列表
export function listLog(query) {
  return request({
    url: "/system/log/list",
    method: "get",
    params: query,
  });
}
//删除处方治疗记录
export function delTreat(treatLogIds) {
  return request({
    url: "/system/log/" + treatLogIds,
    method: "delete",
  });
}
// 查询病人方案列表
export function listPatientPlan(query) {
  return request({
    url: "/system/patientPlan/list",
    method: "get",
    params: query,
  });
}
